/*
 * Copyright (c) QieTv, Inc. 2018
 * @Author: idzeir
 * @Date: 2019-08-27 10:29:56
 * @Last Modified by: ly
 * @Last Modified time: 2019-11-08 18:37:56
 */
import React, { MouseEvent } from 'react';
import css from './index.less';

interface IItemProps {
  type: string;
  top: number;
  left: number;
  clickHandler: (event: MouseEvent) => void;
}

export default class Item extends React.PureComponent<IItemProps> {
  render() {
    return (
      <div
        className={css[this.props.type]}
        style={{
          top: this.props.top,
          left: this.props.left,
        }}
        onClick={
                    this.props.type === 'redpacket'
                      ? this.props.clickHandler
                      : (event) => {
                        event.stopPropagation();
                      }
                }
      />
    );
  }
}
